-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix rendering bug of Markdown Code. #14638
Conversation
println(io, "```", code.language) | ||
# If the code includes a fenced block this will break parsing, | ||
# so it must be enclosed by a longer ````-sequence. | ||
n = mapreduce(length, max, matchall(r"`+", code.code)) + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the regex only match backticks that begin at the start of a line, ie r"^
+"m`?
Also, if code.code
contains no matches mapreduce
would throw
julia> mapreduce(length, max, matchall(r"`+", ""))
ERROR: ArgumentError: reducing over an empty collection is not allowed
in _mapreduce at ./reduce.jl:139
in mapreduce at ./reduce.jl:159
in mapreduce at ./reduce.jl:162
in eval at ./boot.jl:265
since matchall
returns a 0-length vector. Is that a valid edge case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, so it can be:
mapreduce(length, max, 1, matchall(r"^`+"m, code.code))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mapreduce(length, max, 3, matchall(r"^`+"m, code.code))
? To avoid setting n = 1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right. Though you actually still need the + 1 in there. Have updated.
1cc38cb
to
c9a9181
Compare
When a code block included a ```, it would not be rendered correctly.
The 64 bit travis error is surely unrelated:
|
Fix rendering bug of Markdown Code.
When a code block included a ```, it would not be rendered correctly.
cc @MichaelHatherly